 <?php
// // module/Album/view/album/album/index.phtml:
 $title = 'Registration page';
 $this->headTitle($title);
 ?>

<center>
<p>
    <a href="<?php echo $this->url('site', array('action'=>'add'));?>">Add new album</a>
</p>

<table class="table">
<?php $i =0;foreach ($positions as $position) :?>
<?php $i++;?>
    <tr>
    <td><?php echo $this->escapeHtml($position->id);?></td>
    <td><?php echo $this->escapeHtml($position->name);?></td>
    <td><?php echo $this->escapeHtml($position->comments);?></td>
    <td><div class="test" id="content_<?php echo $i ?>"></div></td>
</tr>
<?php endforeach; ?>
</table>
</center>
 <script>  
        function show(index)  
        {  
            $.ajax({  
                url: "<?php echo $this->url('api',array('action'=>'status'));?>/"+index,  
                cache: true,  
                success: function(html){  
                    if(0 != html)
                        $("#content_"+index).html(html);
                    else 
                        $("#content_"+index).html(":)");
                }  
            });  
        }  
      function list()
      {
          for (var i = 0; i < <?php echo ($i+1); ?>; i++) {
              show(i);
            }

            
      }
        $(document).ready(function(){  
            list();  
            setInterval('list()',1000);  
        });  
    </script> 